<template>
    <div>
        <Card style="margin-bottom:10px;">
          <p slot="title">
            <Icon type="ios-analytics"></Icon>
            还款计划详情
          </p>
          <Row type="flex" justify="center" align="middle" class="countto-page-row">
              <template v-for="(item,key) in repayplaninfo">
                  <Labelinfo :key="key" :labelwidth="100" :labeltext="item.title" :infovalue="item.value"></Labelinfo>
              </template>
          </Row>
        </Card>
        <Card style="margin-bottom:10px;">
          <p slot="title">
            <Icon type="ios-analytics"></Icon>
            还款计划子任务
          </p>
          <Row type="flex" justify="center" align="middle" class="countto-page-row">
              <Table :columns="repayplanChildhead" :data="repayplanChildval"></Table>
          </Row>
        </Card>
    </div>
</template>
<script>
import Labelinfo from '_c/infoshow/labelinfo';
import { getflowinfo } from '@/api/data';
import { getAuthkey } from '@/libs/util'
export default {
    name: 'orderinfo',
    data() {
        return {
            repayplaninfo: [],
            repayplanChildhead: [
                {
                    title: '子计划单号',
                    key: 'ipno'
                },
                {
                    title: '计划号',
                    key: 'plan_id'
                },
                {
                    title: '订单id',
                    key: 'pid'
                },
                {
                    title: '金额',
                    key: 'money'
                },
                {
                    title: '状态',
                    key: 'status',
                    render: (h, params) => {
                        return h('div', [
                            h('span', params.row.status === 1?'已经执行': '未执行')
                        ])
                    }
                },
                {
                    title: '卡号',
                    key: 'bank_no'
                },
                {
                    title: '费率',
                    key: 'base_rate'
                },
                {
                    title: '保证金',
                    key: 'repay_ment'
                },
                {
                    title: '保证金额',
                    key: 'repay_money'
                },
            ],
            repayplanChildval: []
        }
    },
    components: {
        Labelinfo
    },
    created() {
        this.getInfo()
    },
    methods:{
        getInfo() {
            let data = {
                auth_key: getAuthkey(),
                plan_id: this.$router.history.current.params.id
            }
            getflowinfo(data).then(res => {
                if(res.data.code !== 200){
                    this.$Message.error(res.data.error)
                    return
                }
                this.repayplanChildval = res.data.data.item;
            }, err => {
                this.$Message.error(err?err: '获取还款详情失败')
            })
        }
    }
}
</script>
